package com.geo.content.dto;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * 内容生成响应DTO
 */
public class ContentGenerationResponse {
    
    /**
     * 生成任务ID
     */
    private String taskId;
    
    /**
     * 生成的内容
     */
    private String generatedContent;
    
    /**
     * 内容标题
     */
    private String title;
    
    /**
     * 内容摘要
     */
    private String summary;
    
    /**
     * 使用的关键词
     */
    private List<String> usedKeywords;
    
    /**
     * 内容质量评分
     */
    private Double qualityScore;
    
    /**
     * SEO优化评分
     */
    private Double seoScore;
    
    /**
     * 生成状态
     */
    private String status;
    
    /**
     * 内容类型
     */
    private String contentType;
    
    /**
     * 生成完成时间
     */
    private LocalDateTime completedAt;
    
    /**
     * 内容长度（字符数）
     */
    private Integer contentLength;
    
    /**
     * 使用的AI模型
     */
    private String modelUsed;
    
    /**
     * Token使用量
     */
    private Integer tokensUsed;
    
    /**
     * 生成耗时（毫秒）
     */
    private Long generationTime;
    
    /**
     * 建议的改进点
     */
    private List<String> improvements;
    
    /**
     * 相关的媒体文件URL
     */
    private List<String> mediaUrls;
    
    /**
     * 错误信息（如果有）
     */
    private String errorMessage;
    
    /**
     * 额外的元数据
     */
    private Map<String, Object> metadata;
    
    // 构造函数
    public ContentGenerationResponse() {}
    
    public ContentGenerationResponse(String taskId, String generatedContent, String status) {
        this.taskId = taskId;
        this.generatedContent = generatedContent;
        this.status = status;
        this.completedAt = LocalDateTime.now();
    }
    
    // Getters and Setters
    public String getTaskId() {
        return taskId;
    }
    
    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }
    
    public String getGeneratedContent() {
        return generatedContent;
    }
    
    public void setGeneratedContent(String generatedContent) {
        this.generatedContent = generatedContent;
    }
    
    public String getTitle() {
        return title;
    }
    
    public void setTitle(String title) {
        this.title = title;
    }
    
    public String getSummary() {
        return summary;
    }
    
    public void setSummary(String summary) {
        this.summary = summary;
    }
    
    public List<String> getUsedKeywords() {
        return usedKeywords;
    }
    
    public void setUsedKeywords(List<String> usedKeywords) {
        this.usedKeywords = usedKeywords;
    }
    
    public Double getQualityScore() {
        return qualityScore;
    }
    
    public void setQualityScore(Double qualityScore) {
        this.qualityScore = qualityScore;
    }
    
    public Double getSeoScore() {
        return seoScore;
    }
    
    public void setSeoScore(Double seoScore) {
        this.seoScore = seoScore;
    }
    
    public String getStatus() {
        return status;
    }
    
    public void setStatus(String status) {
        this.status = status;
    }
    
    public String getContentType() {
        return contentType;
    }
    
    public void setContentType(String contentType) {
        this.contentType = contentType;
    }
    
    public LocalDateTime getCompletedAt() {
        return completedAt;
    }
    
    public void setCompletedAt(LocalDateTime completedAt) {
        this.completedAt = completedAt;
    }
    
    public Integer getContentLength() {
        return contentLength;
    }
    
    public void setContentLength(Integer contentLength) {
        this.contentLength = contentLength;
    }
    
    public String getModelUsed() {
        return modelUsed;
    }
    
    public void setModelUsed(String modelUsed) {
        this.modelUsed = modelUsed;
    }
    
    public Integer getTokensUsed() {
        return tokensUsed;
    }
    
    public void setTokensUsed(Integer tokensUsed) {
        this.tokensUsed = tokensUsed;
    }
    
    public Long getGenerationTime() {
        return generationTime;
    }
    
    public void setGenerationTime(Long generationTime) {
        this.generationTime = generationTime;
    }
    
    public List<String> getImprovements() {
        return improvements;
    }
    
    public void setImprovements(List<String> improvements) {
        this.improvements = improvements;
    }
    
    public List<String> getMediaUrls() {
        return mediaUrls;
    }
    
    public void setMediaUrls(List<String> mediaUrls) {
        this.mediaUrls = mediaUrls;
    }
    
    public String getErrorMessage() {
        return errorMessage;
    }
    
    public void setErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
    }
    
    public Map<String, Object> getMetadata() {
        return metadata;
    }
    
    public void setMetadata(Map<String, Object> metadata) {
        this.metadata = metadata;
    }
    
    // Builder 模式
    public static Builder builder() {
        return new Builder();
    }
    
    public static class Builder {
        private ContentGenerationResponse response;
        
        public Builder() {
            this.response = new ContentGenerationResponse();
        }
        
        public Builder taskId(String taskId) {
            response.setTaskId(taskId);
            return this;
        }
        
        public Builder contentId(String contentId) {
            response.setTaskId(contentId); // 使用taskId作为contentId
            return this;
        }
        
        public Builder generatedContent(String generatedContent) {
            response.setGeneratedContent(generatedContent);
            return this;
        }
        
        public Builder content(String content) {
            response.setGeneratedContent(content);
            return this;
        }
        
        public Builder contentType(String contentType) {
            response.setContentType(contentType);
            return this;
        }
        
        public Builder title(String title) {
            response.setTitle(title);
            return this;
        }
        
        public Builder summary(String summary) {
            response.setSummary(summary);
            return this;
        }
        
        public Builder usedKeywords(List<String> usedKeywords) {
            response.setUsedKeywords(usedKeywords);
            return this;
        }
        
        public Builder qualityScore(Double qualityScore) {
            response.setQualityScore(qualityScore);
            return this;
        }
        
        public Builder seoScore(Double seoScore) {
            response.setSeoScore(seoScore);
            return this;
        }
        
        public Builder status(String status) {
            response.setStatus(status);
            return this;
        }
        
        public Builder completedAt(LocalDateTime completedAt) {
            response.setCompletedAt(completedAt);
            return this;
        }
        
        public Builder generatedAt(LocalDateTime generatedAt) {
            response.setCompletedAt(generatedAt);
            return this;
        }
        
        public Builder contentLength(Integer contentLength) {
            response.setContentLength(contentLength);
            return this;
        }
        
        public Builder wordCount(int wordCount) {
            response.setContentLength(wordCount);
            return this;
        }
        
        public Builder modelUsed(String modelUsed) {
            response.setModelUsed(modelUsed);
            return this;
        }
        
        public Builder tokensUsed(Integer tokensUsed) {
            response.setTokensUsed(tokensUsed);
            return this;
        }
        
        public Builder generationTime(Long generationTime) {
            response.setGenerationTime(generationTime);
            return this;
        }
        
        public Builder improvements(List<String> improvements) {
            response.setImprovements(improvements);
            return this;
        }
        
        public Builder suggestions(List<String> suggestions) {
            response.setImprovements(suggestions); // 使用improvements字段存储suggestions
            return this;
        }
        
        public Builder mediaUrls(List<String> mediaUrls) {
            response.setMediaUrls(mediaUrls);
            return this;
        }
        
        public Builder errorMessage(String errorMessage) {
            response.setErrorMessage(errorMessage);
            return this;
        }
        
        public Builder metadata(Map<String, Object> metadata) {
            response.setMetadata(metadata);
            return this;
        }
        
        public ContentGenerationResponse build() {
            return response;
        }
    }
    
    // 手动添加setContentId方法
    public void setContentId(String contentId) {
        this.taskId = contentId;
    }
    
    // 添加缺失的方法
    public void setContent(String content) {
        this.generatedContent = content;
    }
    
    public void setWordCount(int wordCount) {
        this.contentLength = wordCount;
    }
    
    public String getContentId() {
        return taskId;
    }
}